package com.longge;

/**
 * @创建人 xinglongge
 * @创建时间 2021/11/22
 * @描述
 */
public class NumEquivDominoPairs {

    public int numEquivDominoPairs(int[][] dominoes) {

        int[] num = new int[100];
        int res = 0;
        for (int[] dominoe : dominoes) {
            int high = Math.max(dominoe[0], dominoe[1]);
            int low = Math.min(dominoe[0], dominoe[1]);
            int val = high * 10 + low;
            res += num[val];
            num[val]++;
        }
        return res;
    }
}
